package model.pojo;

import java.sql.ResultSet;

//import model.util.UtilInitLang;
import models.util.MySqlDataAccessHelper;

public class AcCardCompany {
	private String cardCompanyID="";
	private String cardCompanyName="";
	private String bankAccountNo="";
	private String idLoaiTKC1="";
	private String groupCode1CCID="";
	private String groupCode2CCID="";
	private double rateFree=0;
	private String nickName="";
	private String remarks="";
	private int activeSt=1;
	private String activeStName="";
	
	private boolean checked;
	private boolean viewCheck;
	
	private AcBankAccount bankAcInfo =new AcBankAccount();
	private AcLoaiTaiKhoanC1 loaiTKC1Info = null;
	private AcGroupCode1CC g1CCInfo =new AcGroupCode1CC();
	private AcGroupCode2CC g2CCInfo = new AcGroupCode2CC();
	
	
	public boolean isChecked() {
		return checked;
	}
	public void setChecked(boolean checked) {
		this.checked = checked;
	}
	public boolean isViewCheck() {
		if(this.activeSt==1){
			viewCheck=true;
		}else
			viewCheck=false;
		return viewCheck;
	}
	public void setViewCheck(boolean viewCheck) {
		this.viewCheck = viewCheck;
	}
	public String getCardCompanyID() {
		return cardCompanyID;
	}
	public void setCardCompanyID(String cardCompanyID) {
		this.cardCompanyID = cardCompanyID;
	}
	
	public String getCardCompanyName() {
		return cardCompanyName;
	}
	public void setCardCompanyName(String cardCompanyName) {
		this.cardCompanyName = cardCompanyName;
	}
	
	
	
	public String getIdLoaiTKC1() {
		return idLoaiTKC1;
	}
	public void setIdLoaiTKC1(String idLoaiTKC1) {
		this.idLoaiTKC1 = idLoaiTKC1;
	}
	
	public String getGroupCode1CCID() {
		return groupCode1CCID;
	}
	public void setGroupCode1CCID(String groupCode1CCID) {
		this.groupCode1CCID = groupCode1CCID;
	}
	
	public String getGroupCode2CCID() {
		return groupCode2CCID;
	}
	public void setGroupCode2CCID(String groupCode2CCID) {
		this.groupCode2CCID = groupCode2CCID;
	}
	
	public double getRateFree() {
		return rateFree;
	}
	public void setRateFree(double rateFree) {
		this.rateFree = rateFree;
	}
	
	public String getNickName() {
		return nickName;
	}
	public void setNickName(String nickName) {
		this.nickName = nickName;
	}
	
	public String getRemarks() {
		return remarks;
	}
	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}
	
	public int getActiveSt() {
		return activeSt;
	}
	public void setActiveSt(int activeSt) {
		this.activeSt = activeSt;
	}
	
	public String getActiveStName() {
//		UtilInitLang uti=new UtilInitLang();
//		if(this.activeSt==1){
//			activeStName=uti.getAc_SUYes();
//		}else if(this.activeSt==0)
//			activeStName=uti.getAc_SUNo();
		//System.out.println(activeStName);
		return activeStName;
	}
	public void setActiveStName(String activeStName) {
		this.activeStName = activeStName;
	}
	
	public AcBankAccount getBankAcInfo() {
		bankAcInfo=new AcBankAccount();
		if(this.bankAccountNo.equals("")==false){
			MySqlDataAccessHelper helper =new MySqlDataAccessHelper();
			try{
				helper.open();
				String sql="select ac_bankaccount.BankAccountNo,ac_bankaccount.BankAccountName " +
						"from ac_bankaccount " +
						"where ac_bankaccount.BankAccountNo="+this.bankAccountNo;
				ResultSet rs= helper.executeQuery(sql);
				if(rs.next()){
					bankAcInfo.setBankaccountno(rs.getString("BankAccountNo"));
					bankAcInfo.setBankaccountname(rs.getString("BankAccountName"));
				}
				rs.close();
			}catch(Exception e){
				e.printStackTrace();
			}finally{
				helper.close();
			}
		}
		
		return bankAcInfo;
	}
	public String getBankAccountNo() {
		return bankAccountNo;
	}
	public void setBankAccountNo(String bankAccountNo) {
		this.bankAccountNo = bankAccountNo;
	}
	public void setBankAcInfo(AcBankAccount bankAcInfo) {
		this.bankAcInfo = bankAcInfo;
	}
	
	public AcLoaiTaiKhoanC1 getLoaiTKC1Info() {
		loaiTKC1Info=null;
		if(this.idLoaiTKC1.equals("")==false){
			MySqlDataAccessHelper helper =new MySqlDataAccessHelper();
			try{
				helper.open();
				String sql="select ac_loaitaikhoanc1.IDLoaiTKC1," +
						"ac_loaitaikhoanc1.TenLoaiTKC1 " +
						"from ac_loaitaikhoanc1 where ac_loaitaikhoanc1.IDLoaiTKC1='"+this.idLoaiTKC1+"'";
				ResultSet rs= helper.executeQuery(sql);
				if(rs.next()){
					loaiTKC1Info.setIdloaitkc1(rs.getString("IDLoaiTKC1"));
					loaiTKC1Info.setTenloaitkc1(rs.getString("TenLoaiTKC1"));
				}
				rs.close();
			}catch(Exception e){
				e.printStackTrace();
			}finally{
				helper.close();
			}
		}
		
		return loaiTKC1Info;
	}
	public void setLoaiTKC1Info(AcLoaiTaiKhoanC1 loaiTKC1Info) {
		this.loaiTKC1Info = loaiTKC1Info;
	}
	
	public AcGroupCode1CC getG1CCInfo() {
		g1CCInfo=new AcGroupCode1CC();
		if(this.groupCode1CCID.equals("")==false){
			MySqlDataAccessHelper helper =new MySqlDataAccessHelper();
			try{
				helper.open();
				String sql="select ac_groupcode1cc.GroupCode1CCID,ac_groupcode1cc.GroupCode1CCName from ac_groupcode1cc where ac_groupcode1cc.GroupCode1CCID='"+this.groupCode1CCID+"'";
				ResultSet rs= helper.executeQuery(sql);
				if(rs.next()){
					g1CCInfo.setGroupCode1CCID(rs.getString("GroupCode1CCID"));
					g1CCInfo.setGroupCode1CCName(rs.getString("GroupCode1CCName"));
				}
				rs.close();
			}catch(Exception e){
				e.printStackTrace();
			}finally{
				helper.close();
			}
		}
		
		return g1CCInfo;
	}
	public void setG1CCInfo(AcGroupCode1CC g1ccInfo) {
		g1CCInfo = g1ccInfo;
	}
	
	public AcGroupCode2CC getG2CCInfo() {
		g2CCInfo=new AcGroupCode2CC();
		if(this.groupCode2CCID.equals("")==false){
			MySqlDataAccessHelper helper =new MySqlDataAccessHelper();
			try{
				helper.open();
				String sql="select ac_groupcode2cc.GroupCode2CCID,ac_groupcode2cc.GroupCode2CCName from ac_groupcode2cc where ac_groupcode2cc.GroupCode2CCID='"+this.groupCode2CCID+"'";
				ResultSet rs= helper.executeQuery(sql);
				if(rs.next()){
					g2CCInfo.setGroupCode2CCID(rs.getString("GroupCode2CCID"));
					g2CCInfo.setGroupCode2CCName(rs.getString("GroupCode2CCName"));
				}
				rs.close();
			}catch(Exception e){
				e.printStackTrace();
			}finally{
				helper.close();
			}
		}
		return g2CCInfo;
	}
	public void setG2CCInfo(AcGroupCode2CC g2ccInfo) {
		g2CCInfo = g2ccInfo;
	}
	
	
	
}
